/*
 * Copyright (C) 2010-2011 Comcast Cable.  All Rights Reserved.
 */
package com.hercules.android.receiver.handlers.commands;

/**
 * This exception is raised by {@link XRESetCommandHandler} if it encounter a parameter exists in both
 * XRESetCommand#props and XRESetCommand#runtimeExpressionProperties map.
 * <p>
 * Note the exception will only be propagated to {@link XREAggregateCommandHandler} and then processed by
 * {@link XRECommandErrorHandler}. It extends {@link XREObjectCommandHandlerException}.
 * <p>
 * <b>Thread Safety:</b> This class is not thread safe as its base class is not thread safe.
 *
 * @author liuliquan, 7realm
 * @version 1.0
 */
public class DuplicateXRECommandParameterException extends XREObjectCommandHandlerException {
    /** Serial version UID. */
    private static final long serialVersionUID = 5915057452797436020L;
    /**
     * The duplicate parameter.
     * <p>
     * Initialized in constructor and will not change after. Can be any value. It has a getter.
     */
    private final String duplicateParameter;

    /**
     * Creates a new instance of {@link DuplicateXRECommandParameterException} with given error message and the
     * duplicate parameter.
     *
     * @param message the error message
     * @param duplicateParameter the duplicate parameter
     */
    public DuplicateXRECommandParameterException(String message, String duplicateParameter) {
        super(message);
        this.duplicateParameter = duplicateParameter;
    }

    /**
     * Creates a new instance of {@link DuplicateXRECommandParameterException} with given error message, the cause and
     * the duplicate parameter.
     *
     * @param message the error message
     * @param cause the cause of the exception
     * @param duplicateParameter the duplicate parameter
     */
    public DuplicateXRECommandParameterException(String message, Throwable cause, String duplicateParameter) {
        super(message, cause);
        this.duplicateParameter = duplicateParameter;
    }

    /**
     * Gets the duplicate parameter.
     *
     * @return the duplicate parameter
     */
    public String getDuplicateParameter() {
        return duplicateParameter;
    }
}